#!/bin/bash
# Author    : MoShangSan
# create_ts : 2024-02-10
# program   : Compile Code, Convert DOS/Mac text file format into Unix, Tar package
bash_path=$(cd `dirname $0`; pwd)
CURRENT_PATH=$(cd ${bash_path}/..; pwd)
APP_NAME="vocechat_robot_gpt"
LOG_FILE=${CURRENT_PATH}/log/${APP_NAME}_$(date "+%Y%m%d%H%M%S").log
SHELL_NAME="install.sh"

function LOG() {
    USER=$(whoami) ####那个用户在操作
    if [ ! -e ${CURRENT_PATH}/log ];then
       mkdir ${CURRENT_PATH}/log
    fi
    if [ ! -f ${LOG_FILE} ];then
       touch ${LOG_FILE}
    fi
    echo "[${DATE}] ${USER} [$1][$SHELL_NAME]$2"
    echo "[${DATE}] ${USER} [$1][$SHELL_NAME]$2" >> ${LOG_FILE}  ######（$0脚本本身，$@将参数作为整体传输调用, >> 将输出结果以追加的方式添加重定向到本地文件中）
}

pip3 install miservice
if [ $? -ne 0 ]
    LOG ERROR "miservice intstall fail"
else
    LOG INFO "miservice intstall success"
fi